#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+2;
int n;
int cnt,idx;
int hed[maxn],fa[maxn],d[maxn],son[maxn];
struct node_edge{
    int nxt,to;
}G[maxn*2];
set<int>s;
set<int>::iterator it;
void add(int u,int v){
    G[++cnt]=(node_edge){hed[u],v};
    hed[u]=cnt;
    return ;
}
int read(){
    int x=0,f=0;
    char ch=getchar();
    while(!isdigit(ch))f=((ch=='-')?-f:f),ch=getchar();
    while(isdigit(ch))x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
    return x;
}
int ot[40],tp;
void write(int x){
    if(x=='0'){putchar('0');return ;}
    while(x)ot[++tp]=x%10,x/=10;
    while(tp)putchar(ot[tp--]+'0');
    return ;
}
void dfs(int x,int f){
    fa[x]=f;
    for(int i=hed[x],v;i;i=G[i].nxt){
        v=G[i].to;
        if(v==f)continue;
        son[x]++;
        dfs(v,x);
    }
    if(!son[x])s.insert(x);
    return ;
}
int main(){
    freopen("choice.in","r",stdin);
    freopen("choice.out","w",stdout);
    n=read();
    for(int i=1,u,v;i<n;i++){
        u=read(),v=read();
        add(u,v);
        add(v,u);
    }
    dfs(1,0);
    while(s.begin()!=s.end()){
        it=s.end();
        it--;
        d[++idx]=*it;
        son[fa[*it]]--;
        if(fa[*it]&&!son[fa[*it]])s.insert(fa[*it]);
        s.erase(it);
    }
    for(int i=idx;i;i--)write(d[i]),putchar(' ');
    return 0;
}